package ray.mgocc.net;

import java.io.InputStream;
import ray.mgocc.StoredSource;
import ray.mgocc.Source;

public class ComplexSource implements Source{
    private Source first;
    private Source second;
    protected ComplexSource(Source evrytime){
        this(null,evrytime);
    }
    public ComplexSource(Source first,Source second){
        this.first = first;
        this.second = second;
    }
    public void close(){
        if(null!=first){
            first = null;
        }
        if(null!=second){
            second = null;
        }
    }
    public InputStream getStream(){
        InputStream in = null;
        if(null!=first){
            in = first.getStream();
            first = null;
        }
        if(null==in && null!=second){
            in = second.getStream();
        }
        return in;
    }
    public String toString(){
        return super.toString()+"{1:"+first+",2:"+second+"}";
    }
}
